<?php

/**
 * 检查用户身份证号，是否已有
 * @author dinglin
 *
 */
apf_require_class('APF_Controller');
apf_require_class('Bll_Hr_User');
apf_require_class('Util_BaseUrls');
class Hr_Ajax_GetIdCardController extends APF_Controller {

    public function handle_request() {
        $params = APF::get_instance()->get_request()->get_parameters();
        $id_card = trim($params['id_card']);
        $id_type = intval($params['card_type']);
        $bll = new Bll_Hr_User();
        $user_id = $bll->check_idcard_is_used($id_card,$id_type);
        if($user_id){
            $this->json_encode(1,Util_BaseUrls::staff_add_url($user_id));//有
        }else{
            $this->json_encode(0,"");//没有
        }
    }
    /**
     *
     * @param int $status 0错误 1成功
     * @param unknown_type $res
     */
    public function json_encode($status,$res){
        $result = array(
                'errcode'=>$status
        );
        if($status){
            $result['data']=$res;
        }else{
            $result['msg']=$res;
        }
        echo json_encode($result);
        exit();
    }

}